<template>
    <!-- 专辑列表 -->
    <div class="list">
        <div
            class="item"
            v-for="item of albums"
            :key="item.id"
            @click="toDetail(item)"
        >
            <!-- 专辑图片 -->
            <div class="img_box">
                <el-image
                    :src="item.picUrl + '?param=300y300'"
                    lazy
                >
                    <div
                        slot="placeholder"
                        class="image-slot "
                    >
                        <p>加载中<span class="dot">...</span></p>
                    </div>
                    <div
                        slot="error"
                        class="image-slot"
                    >
                        <i class="el-icon-picture-outline"></i>
                    </div>
                </el-image>
                <!-- 播放次数 -->
                <div class="count flex-between">
                    <i class="el-icon-caret-right"></i>
                    <span>{{ item.subType || item.type }}</span>
                </div>
            </div>
            <!-- 专辑名字 -->
            <div class="info">
                <div class="name ellipsis">{{ item.name }}</div>
                <div class="author">{{ item.artist.name }}</div>
                <div class="time author">
                    {{ utils.dateFormat(item.publishTime, 'YYYY-MM-DD') }}
                </div>
            </div>
        </div>
    </div>
</template>

<script>
export default {
    data() {
        return {}
    },
    props: {
        albums: {
            type: Array
        },
        loadStatus: {
            type: Boolean
        },
        loading: {
            type: Boolean
        }
    },
    components: {},
    computed: {
        noMore() {
            return !this.loading
        },
        disabled() {
            return this.loading || this.noMore
        }
    },
    watch: {},
    methods: {
        toDetail(id) {
            this.$router.push({
                name: 'albumDetail',
                query: {
                    id
                }
            })
        }
    },
    created() { },
    mounted() { }
}
</script>
<style lang="less" scoped>
.list {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -40px;
    .item {
        padding: 0 15px 30px;
        flex: 0 0 16.6%;
        max-width: 16.6%;
        cursor: pointer;
        .img_box {
            position: relative;
            .el-image {
                border-radius: 8px;
                box-shadow: 6px 6px 12px #7f54f7;
            }
            .count {
                position: absolute;
                right: 16px;
                top: 6px;
                height: 20px;
                line-height: 20px;
                padding: 5px 9px;
                background: #001720;
                color: #fff;
                font-size: 12px;
                font-weight: 700;
                border-radius: 3px;
            }
        }
        .info {
            margin-top: 15px;
            .name {
                font-weight: bold;
                line-height: 18px;
            }
            .author {
                margin-top: 5px;
                font-size: 12px;
                color: #999;
            }
        }
    }
}
</style>
